package org.apaydin.widget;

import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;

public class StringUtils {

    public static String toString(Collection<String> list, String sep){
        StringBuffer buffer = new StringBuffer();
        int i = 0;
        int len = list.size();
        for (String s : list) {
            buffer.append(s);
            if(i != len -1){
                buffer.append(sep);
            }
        }
        return buffer.toString();
    }

    public static String toString(Date date, String pattern){
        return new SimpleDateFormat(pattern).format(date);
    }

    public static String toString(Date date){
        return toString(date, "dd/MM/yyyy");
    }

}
